import request from '@/utils/request'

// 获取快递员分页数据
export const getCourierAPI = (params) => {
  return request({
    url: '/manager/business-hall/courier/page',
    method: 'get',
    params: params
  })
}

// 获取作业范围数据
export const getJodAreaAPI = (id, type) => {
  return request({
    url: '/manager/business-hall/scope/' + id + '/' + type,
    method: 'get'
  })
}

// 获取司机分页数据
export const getDriverAPI = (params) => {
  return request({
    url: '/manager/driver/page',
    method: 'get',
    params: params
  })
}

// 获取司机基本信息详情
export const getDriverDetailAPI = (id) => {
  return request({
    url: '/manager/driver/' + id,
    method: 'get'
  })
}

// 获取司机驾驶证信息
export const getDriverLicenseAPI = (id) => {
  return request({
    url: '/manager/driverLicense/' + id,
    method: 'get'
  })
}

// 获取排班分页数据
export const getScheduleAPI = (params) => {
  return request({
    url: '/manager/work-schedulings',
    methodL: 'get',
    params: params
  })
}

// 获取工作模式分页数据
export const getPatternsListAPI = (params) => {
  return request({
    url: '/manager/work-patterns/page',
    method: 'get',
    params: params
  })
}

// 获取工作模式数据
export const getPatternsAPI = () => {
  return request({
    url: '/manager/work-patterns/all',
    method: 'get'
  })
}

// 保存业务范围
export const saveBusinessScopeAPI = (data) => {
  return request({
    url: '/manager/business-hall/scope',
    method: 'post',
    data: data
  })
}

// 保存司机基本信息
export const saveDriverAPI = (id, {
  age, avatar, mobile, name, userId, workNumber, workStatus }) => {
  return request({
    url: '/manager/driver/' + id,
    method: 'put',
    data: {
      age,
      avatar,
      mobile,
      name,
      userId,
      workNumber,
      workStatus
    }
  })
}

// 工作模式删除
export const delPatternsAPI = (id) => {
  return request({
    url: '/manager/work-patterns/' + id,
    method: 'delete'
  })
}

// 添加工作模式
export const addPatternsAPI = (
  { friday, id, monday, name, operator, restDayNum, saturday, sunday, thursday, tuesday, wednesday, workDayNum, workEndMinute1, workStartMinute1
  }) => {
  return request({
    url: '/manager/work-patterns',
    method: 'post',
    data: {
      friday, id, monday, name, operator, restDayNum, saturday, sunday, thursday, tuesday, wednesday, workDayNum, workEndMinute1, workStartMinute1
    }
  })
}

// 修改工作模式
export const editParrernsAPI = (data, id) => {
  return request({
    url: '/manager/work-patterns',
    method: 'put',
    data: {
      data,
      id
    }
  })
}

// 获取工作模式详情
export const getPatternsDetailAPI = (id) => {
  return request({
    url: '/manager/work-patterns/' + id,
    method: 'get'
  })
}

